package cs2340.klondike.TaskFudger;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

/**
 * This is a customPinpoint class that allows LocationsActivity class to create and display the pinpoints.
 * @author Shezil
 */
public class CustomPinpoint extends ItemizedOverlay<OverlayItem>{

	private ArrayList<OverlayItem> pinpoints = new ArrayList<OverlayItem>();
	private Context c;
	
	/**
	 * Constructor that takes in a single drawable parameter
	 * @param marker
	 */
	public CustomPinpoint(Drawable marker) {
		super(boundCenter(marker));
		// TODO Auto-generated constructor stub
	}

	/**
	 * Constructor with two parameters. Drawable and the context
	 * @param m
	 * @param context
	 */
	public CustomPinpoint(Drawable m, Context context) {
		// TODO Auto-generated constructor stub
		this(m);
		c = context;
	}
	
	/* (non-Javadoc)
	 * @see com.google.android.maps.ItemizedOverlay#createItem(int)
	 */
	@Override
	protected OverlayItem createItem(int i) {
		// TODO Auto-generated method stub
		return pinpoints.get(i);
	}

	/* (non-Javadoc)
	 * @see com.google.android.maps.ItemizedOverlay#size()
	 */
	@Override
	public int size() {
		// TODO Auto-generated method stub
		return pinpoints.size();
	}
	
	/**
	 * This method inserts the Pinpoint on the overlayItem on the map.
	 * @param item
	 */
	public void insertPinpoint(OverlayItem item) {
		pinpoints.add(item);
		this.populate();
	}

}
